
<link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/reset.css">
<link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/swiper.min.css">
<link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/style.css?v=11">

<script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
<style type="text/css">
    .fixBottom{
        z-index: 2;
    }
    .strategy .statTxt{
        width: 3.83rem !important;
    }
    .timeEnd12{
        padding-top: .16rem !important;
    }
    .myWinner .timeEnd12{
        padding: 0 0.16rem!important;
        margin-top: 0.2rem;
    }
    .winerChosen{
        padding: 0 0.43rem 0 0.34rem;
    }
    .dataBox{
        padding: 0;
        overflow: hidden;
    }
    .strategy li{
        margin: 0 0.26rem;
    }
    .strategy .f_list{
        background: #ffdaa2;
        padding: 0.2rem 0.5rem 0.14rem 0.1rem;
        margin: .2rem 0.26rem .2rem 0.9rem;
        /* margin: 0 0 0.2rem; */
        border-radius: 0.1rem;
        position: relative;
        height: 0.8rem;
        overflow: visible;
    }
    .strategy .f_list::after{
        content: "";
        display: block;
        clear: both;
        border: 0.2rem solid transparent;
        border-bottom-color: #ffdaa2;
        width: 0;
        height: 0;
        position: absolute;
        top: -0.3rem;
        left: 0.5rem;
    }
    .strategy .f_list:not(.li_np)>div,.strategy .f_list.li_np>div>div{
        height: 0.8rem;
        overflow: hidden;
        display: flex;
        justify-content: space-evenly;
    }
    .strategy .f_list.li_np{
        padding-right: 0.5rem;
    }
    .strategy .f_list>a,.strategy .f_list.li_np>div>a{
        background: #c98e4b;
        color: #ffdaa2;
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 0.5rem;
        text-align: center;
        line-height: 0.5rem;
        writing-mode: vertical-lr;
        writing-mode: tb-lr;
        border-radius: 0 0.1rem 0.1rem 0;
    }
    .strategy .f_list .f_list_item{
        margin-right: 0.1rem;
        float: left;
        margin-bottom: 0.2rem;
    }
    .strategy .f_list.li_np .f_list_item .f_list_img_wrap{

        width: 0.72rem;
        height: 0.72rem;
    }
    .strategy .f_list .f_list_item .f_list_img_wrap{
        width: 0.76rem;
        height: 0.76rem;
        border-radius: 0.41rem;
        position: relative;

    }
    .strategy .f_list.li_np .f_list_item .f_list_img_wrap span{

        width: 0.68rem;
        height: 0.68rem;
    }
    .strategy .f_list .f_list_item .f_list_img_wrap span{
        line-height: 0.76rem;
        width: 0.72rem;
        height: 0.72rem;
        text-align: center;
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        border: 0.02rem solid #c98e4b;
        border-radius: 0.41rem;
        color: #c98e4b;
    }
    .strategy .f_list .f_list_item>span{
        display: block;
        color: #c98e4b;
        text-align: center;
        margin-top: 0.1rem;
        font-size: 0.2rem;
    }
    .strategy .f_list.li_np .f_list_item .f_list_img_wrap img{
        width: 0.72rem;
        height: 0.72rem;
    }
    .strategy .f_list .f_list_item .f_list_img_wrap img{
        width: 0.76rem;
        height: 0.76rem;
        border-radius: 0.41rem;
    }
    .strategy .f_list .f_list_item .f_list_img_wrap img[src=""],.strategy .f_list .f_list_item .f_list_img_wrap img:not([src]){
        opacity:0;
    }
    .redbagTxt p{
        text-shadow: 0.04rem 0.06rem 0.07rem #ff6a69;
    }
    .redBag a.getBag{
        transform: none;
        position: static;
        height: 0.44rem;
        display: flex;
        justify-content: center;
        align-items: center;
        line-height: normal;
        margin: 0.1rem auto 0;
    }
    .redBag .redbagBtn{
        position: absolute;
        top: 0.26rem;
        /*bottom: 0.34rem;*/
        right: 0.24rem;
        text-align: center;
    }
    .redBag .redbagBtn span{
        transform: none;
        color: rgba(255,255,255,0.63);
        text-align: center;
        font-weight: bold;
    }
    .myGift{
        padding-top: 1.5rem;
    }
    .myGift div:first-child{
        margin-bottom: 0.12rem;
        font-weight: bold;
        font-size: 0.3rem;
    }
    .ticketBox .convert_code img{
        width: 100%!important;
        height: 100%!important;
    }
    .ticeketList ul {
        /*max-height: 7.3rem;*/
    }
    .yx_peopleList li{
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }
    .gameControl a{
        background: #930000 url(https://css2020.yixuan.net/2020css/plugin/lottery/images/btn3.png) center no-repeat;
        border-radius: 0.26rem;
        background-size: 100% auto;
    }
    .myWinner .yx_choseBar.yx_peopleList{
        position: absolute;
        bottom: 0;
        top: 2.29rem;
        left:0.34rem;
        right:0.43rem;
    }
    .myWinner .ticeketList{
        position: absolute;
        top: 12vh;
        bottom: 0;
        display: flex;
        left:8vw;
        right:0;
        flex-direction: column;
    }
    .redBag{
        overflow: visible;
    }


    .redWrap{
        z-index: 1;
        background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/vxTXaa2rwtBATA2LlJXVjIXXMbaJ5p.png) no-repeat -0.08rem top;
        background-size: 100% auto;
        position: relative;
    }
    .redWrap .h{
        color: #a66e4d;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 0.4rem;
    }
    .redWrap .h div{
        position: relative;
    }
    .redWrap .h text{
        width: 0.11rem;
        height: 0.11rem;
        border-radius: 0.11rem;
        border: 0.01rem solid #a66e4d;
        position: absolute;
        top: 0;
        bottom: 0;
        margin: auto;
    }
    .redWrap .h text.l{
        left: -0.3rem;
    }
    .redWrap .h text.r{
        right: -0.3rem;
    }
    .redWrap .h text::after{
        content: "";
        display: block;
        width: 0.05rem;
        height: 0.05rem;
        border-radius: 0.05rem;
        background: #a66e4d;
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        margin: auto;
    }
    .redWrap .btn{
        background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/O1s6QWtmD6ddQwytdsLyL2ytR9S2yE.png) no-repeat center;
        width: 2.48rem;
        height: 0.64rem;
        background-size: 100% 100%;
        margin: 0 auto;
        color: #cd4e42;
        line-height: 0.64rem;
        text-align: center;
        position: absolute;
        bottom: 0.8rem;
        left: 0;
        right: 0;
    }
    .redWrap .price{
        display: flex;
        justify-content: center;
        align-items: flex-end;
        margin-top: 0.3rem;
    }
    .redWrap .price .num{
        font-size: 1rem;
        line-height: 2rem;
        font-weight: bold;
        color: #ee5f52;
        position: relative;
    }
    .redWrap .price .num::after{
        content: "";
        display: inline-block;
        width: 0.4rem;
    }
    .redWrap .price .num .flag{
        font-size: 0.3rem;
        width: 0.4rem;
        height: 0.4rem;
        line-height: 0.4rem;
        background: #ee5f52;
        color: #ffffff;
        position: absolute;
        bottom: 0.6rem;
        right: 0;
        border-radius: 0.4rem;
        text-align: center;
    }

    .redGetWrap{
        z-index: 1;
        background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/RSQrw87Q4UE6cS41uR8cw6QW4YC8cs.png) no-repeat -0.16rem top;
        background-size: 100% auto;
        position: relative;
        color: #d1302d;
        overflow: hidden;
    }
    .redGetWrap .h{
        margin-top: 1.56rem;
        font-size: 0.40rem;
        text-align: center;
    }
    .redGetWrap .name{
        margin-top: 0.04rem;
        font-size: 0.30rem;
        text-align: center;
    }
    .redGetWrap .price{
        margin-top: 0.04rem;
        display: flex;
        justify-content: center;
        align-items: flex-end;
    }

    .redGetWrap .price .num{
        font-size: 1.10rem;
        line-height: 1.10rem;
        font-weight: bold;
        color: #ee5f52;
        position: relative;
    }
    .redGetWrap .price .num::after{
        content: "";
        display: inline-block;
        width: 0.40rem;
    }
    .redGetWrap .price .num .flag{
        font-size: 0.30rem;
        width: 0.40rem;
        height: 0.40rem;
        line-height: 0.40rem;
        background: #ee5f52;
        color: #ffffff;
        position: absolute;
        bottom: 0.16rem;
        right: 0;
        border-radius: 0.40rem;
        text-align: center;
    }
    .redGetWrap .btn{
        background: #fefaee;
        width: 2.48rem;
        height: 0.70rem;
        border-radius: 0.64rem;
        background-size: 100% 100%;
        margin: 0 auto;
        color: #cd4e42;
        line-height: 0.70rem;
        text-align: center;
        position: absolute;
        bottom: 1.80rem;
        left: 0;
        right: 0;
        font-size: 0.30rem;
    }
    .redGetWrap .anim_txt{
        color: rgba(255,255,255,0.8);
        text-align: center;
        position: absolute;
        bottom: 1.30rem;
        left: 0;
        right: 0;
        font-size: 0.2rem;
        animation: anim_txt 1s infinite;
    }
    .peoInfor{
        font-size: .25rem;
    }
    .peoName{
        width: 1.14rem;
    }
    .small_color{
        background-image:linear-gradient( to right ,rgba(255,119,55,0.37), rgba(249,156,68,0.37)) !important;
    }
    @keyframes anim_txt {
        0%{
            opacity: 0;
        }
        50%{
            opacity: 0;
        }
        51%{
            opacity: 1;
        }
        99%{
            opacity: 1;
        }
        100%{
            opacity: 0;
        }
    }
    .winTxt{
        max-width: 200px;
    }
    .orderList>div{
        overflow: visible;
    }
    .luckyImg img{
        width: 2.82rem !important;
        height: 2.82rem !important;
    }
    .luckyAlt .goPlay{
        margin: .2rem auto 0 !important;
    }
    .show_allpersonal {padding: 10px; margin-top: -40px; position: relative;}
    .show_allpersonal div {background: #ffdf01; padding: 5px; border-radius: 10px;}
    .show_allpersonal div ul {border: 1px dotted #fff; text-align: center; color: #000; height: 38px; line-height: 38px; font-size: 12px; border-radius: 10px;}
    #new_screen{
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index:3;
    }
    .choseBar span{
        background: none;
        padding-left: 0;
    }
</style>
<script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>

<!--新遮罩层-->
<div id="new_screen" onclick="close_alert()" style="display: none">

</div>

<!--我的奖品弹出-->
<div class="myWinner">
    <span class="winClose" onclick="closeMyGifts()"></span>
    <!--<h4>· 我的奖品 ·</h4>-->
    <div class="winerChosen">
        <div class="choseBar ">
            <div class="ticeketList">
                <ul id="list_ul">

                </ul>
<!--                <a href="" class="continue">继续抽奖</a>-->
            </div>
        </div>

    </div>
</div>
<!--获得礼品弹出层-->
<div id="gift_div">
    <div class="getAlt">
        <div class="getBox">
            <h2>· 恭喜抽中了 ·</h2>
            <div class="producePic">
                <img src="" class="alertImg">
            </div>
            <p class="alertTitle"></p>
            <span>转发朋友圈后方可领取礼品</span>
            <div class="getControl">
                <a href="javascript:void(0);" onclick="showSharePyq(this)" data-gid="" id="showGiftPyq">立即转发</a>
            </div>
        </div>
        <span class="close getAlt_close" onclick="closeGetAlt()"></span>
    </div>
</div>
<!--右侧浮标-->
<a class="fudfai_right letgofenxiao yyyIcon" style="bottom: 3.4rem;display: none" >
<img id="fudai2" src="{$config['yx_gift_icon']}" alt="">
</a>

<!--兑换二维码-->
<style type="text/css">
    .altTit1 { width:4.7rem; position:relative; z-index:101; height:.84rem; background:#7094ff; margin:0 auto; border-radius:.15rem; text-align:center; line-height:.84rem; color:#fff; font-size:.32rem;}
    .altTit2 { width:5rem; position:relative; margin-top:-38px;z-index:101; height:.84rem;  line-height:.84rem; color:#fff; font-size:.32rem;text-align:center;}
    .altBox1 { display:none; position:fixed; z-index:101; left:50%; top:50%; margin-left:-2.79rem; margin-top:-2.78rem;}
    .ewmBar { width:5.58rem; height:5.56rem; box-sizing:border-box; padding-top:.9rem; margin-top:-.4rem; border-radius:.15rem; background:#fff; box-sizing:border-box;}
    #screen2{ display:none; position:fixed; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:100;}
    .ewmImg { width:3.94rem; box-sizing:border-box; padding:.16rem; border:1px solid #a6d5ff; border-radius:.08rem; margin:0 auto 0;}
</style>
<div id="screen2" onclick="closeQrShow(1)"></div>
<div class="altBox1">
    <div class="altTit1"></div>
    <div class="ewmBar">
        <div class="ewmImg"><img id="qr_img" src=""></div>
    </div>
    <div class="altTit2">
        <span style="background:#D3D3D3;  border-radius:.15rem; color:black;width:2rem;margin-left: 20px;margin-right: 18px;padding: 4px 8px" onclick="closeQrShow(1)">关闭窗口</span>
        <span style="background:#7094ff; border-radius:.15rem; color:#fff;width:2rem;padding: 4px 8px" onclick="closeQrShow(2)">联系客服</span>
    </div>
</div>


<div id="writeInfo" class="yx_altBox" style="display: none;">
    <div class="writeInfo" style="position: relative; padding-top: 1.95rem; background: url(https://css2020.yixuan.net/2020css/plugin/lottery/images/myinfo.png) center no-repeat;
        width: 6.09rem; height: 7.2rem;background-size: 100% auto; text-align: center;">
        <div style="margin: 0 auto;margin-top:50px;height: 30px;line-height: 30px;font-size:.3rem;color: #af6e27;">
            领奖姓名：<input id="receive_name" name="receive_name" style="width:2.8rem;text-align:center;height: 24px;line-height: 24px;border-radius: 4px;border: 1px solid #af6e27;">
             </div>
        <div style="margin: 0 auto; margin-top:30px;height: 30px;line-height: 30px;font-size:.3rem;color: #af6e27">领奖电话：
            <input id="receive_phone" name="receive_phone" type="tel"  maxlength="11" style="width:2.8rem;text-align:center;height: 24px;line-height: 24px;border-radius: 4px;border: 1px solid #af6e27;">
            </div>
         <a id="receive_btn"  href="javascript:;" onclick="subCusterInfo()" class="backPlay">保存</a>
        </div>
</div>

<div class="content">
    {if (empty($config['yaoyiyaotip']))}
    <img class="lazy" src="{$_G['URL']['WORKER_CSS']}images/yaoyiyao.gif" />
    {else}
    <img class="lazy" src="{php echo tomedia($config['yaoyiyaotip']);}" />
    {/if}
</div>

<div class="metro_container content shake_moneybg" style="padding: 0; margin-bottom: 0;
        background: #2f2f2f;">
    <div class="content show_allpersonal" style="margin-top:0px;">
        <div class="content">
            <ul class="content">
                <li style="color: #685B02; font-weight:bold;"><span>&#24050;&#26377;<b style="color:#ED155B">{$commyaoyiyao}</b>&#20154;&#25671;&#21040;&#29616;&#37329;<b style="color:#ED155B">{$commyaoyiyaofee}</b>&#20803;</span></li>
            </ul>
        </div>
    </div>
</div>

<audio id="musicBox">
    <source src="http://css.yixuan.net/weike/images/yaoyiyao.mp3" type="audio/mpeg">
</audio>

<script type="text/javascript">
    //整理图片尺寸
    window.onload = function(){
        var photo_size2 = $(".fudai_shake ol img:first").width() / 1.6;
        $(".photo_size2").height(photo_size2);
    }

    function openshake() {
        setTimeout(function () {
            $('#fudai').removeClass('get_shake');
            closeshake();
        }, 500) ;
    }
    function closeshake() {
        setTimeout(function () {
            $('#fudai').addClass('get_shake');
            openshake();
        }, 500) ;
    }
    openshake();

    window.onload = function() {
        function show_register(){
            var go_top = $(".fudai_shake").offset().top;
            $(".fudai_shake").show();
            $('html,body').animate({scrollTop: go_top}, 800)
        }
        {php echo empty($lingqu)?"":"show_register();";}
    };
</script>

<!--测试页面销毁请求-->
<script type="text/javascript">
    var u = navigator.userAgent;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    var formurl = '/{php echo createMobileUrl("demo",array("themeid"=>$themeid,"op"=>"listener"));}';


    if (isAndroid) { //安卓
        if (window.addEventListener) {
            document.addEventListener("visibilitychange", function () { //部分手机可以获取到
                // do something
                if (document.hidden) {
                    console.log(localStorage.getItem('isOut6'));
                    sendAjax("getSysTimes", "get", function () { //发送请求
                        console.log(result)
                    })
                }
            })
        } else if (window.attachEvent) {
            // 主要是为了兼容老的IE
            window.attachEvent('onpagehide', function () {
                localStorage.setItem('isOut5', false)
                console.log(localStorage.getItem('isOut5'));
            })
        } else {
            window.onbeforeunload = function () {
                localStorage.setItem('isOut5', false)
                console.log(localStorage.getItem('isOut5'));
            }
        }
    }
    if (isiOS) { //苹果
        window.addEventListener("pagehide", function (e) {
            $.ajaxSettings.async = false; //无效
            var formData2 = new FormData();
            formData2.append("name", "呵呵");
            navigator.sendBeacon(formurl, formData2);//formurl写后台接受数据地址
        }, false);
    }
</script>
<!--测试页面销毁请求-->
<!--摇一摇 多产品JS-->
<script>
    document.addEventListener("WeixinJSBridgeReady", function () {
        document.getElementById('musicBox').play();
        document.getElementById('musicBox').pause();
    }, false);



    window.onload=function(){
        var ua = navigator.userAgent.toLowerCase();
        if (/ipad|iphone|mac/i.test(navigator.userAgent)){
            // 正则判断手机系统版本
            var reg = /os [\d._]*/gi ;
            var verinfo = ua.match(reg) ;
            var version = (verinfo+"").replace(/[^0-9|_.]/ig,"").replace(/_/ig,".");
            if (parseFloat(version) >= 12) {  //对13.3以后的版本处理,包括13.3
                DeviceMotionEvent.requestPermission().then(permissionState => {
                    if (permissionState === 'granted') { //已授权
                        ios13granted() //摇一摇
                    } else if(permissionState === 'denied'){
            // 打开的链接不是https开头
                        layer.msg("当前IOS系统拒绝访问动作与方向。请退出微信，重新进入活动页面获取权限。")
                    }
                }).catch((err)=>{
                    layer.confirm("由于IOS系统需要手动获取访问动作与方向的权限，为了保证摇一摇正常运行，请在访问提示中点击允许！",{btn:['确定'],btnAlign:'c'},function (index) {
                        ios13granted();
                        layer.close(index);
                    })
                    //======这里可以防止重复授权，需要改动，因为获取权限需要点击事件才能触发，所以这里可以改成某个提示框===//
                    console.log("由于IOS系统需要手动获取访问动作与方向的权限，为了保证摇一摇正常运行，请在访问提示中点击允许！")
                });
            }else{  //12以前的版本
                ios13granted();
                console.log("苹果系统12以前的版本")
            }
        }else{
            //安卓设备
            console.log('安卓设备');
            init();
        }
        getYxGiftBase();
    }

    var SHAKE_THRESHOLD=3000;//定义一个摇动的阈值
    var last_update=0;//定义一个变量记录上一次摇动的时间
    var x=y=z=last_x=last_y=last_z=0;//定义x、y、z记录三个轴的数据以及上一次触发的时间
    function init(type){
        //判断移动浏览器是否支持运动传感器事件
        //添加一个事件监听器
        if (type==1){
            //安卓设备或ios<13
            if(window.DeviceMotionEvent){
                window.addEventListener('devicemotion',deviceMotionHandler,false);
                // ds.dialog({
                //     title : '&#32418;&#21253;&#25552;&#31034;',
                //     content : '&#24744;&#30340;&#35774;&#22791;&#19981;&#25903;&#25345;&#25671;&#19968;&#25671;&#65281;',
                //     yesText : '&#30830;&#23450;',
                //     timeout :2.5,
                // });
            }else{
                layer.msg('当前设备不支持摇一摇');
            }
        }else{
            //苹果设备 13+
            window.addEventListener('devicemotion',deviceMotionHandler,false);
            // ds.dialog({
            //     title : '&#32418;&#21253;&#25552;&#31034;',
            //     content : '&#24744;&#30340;&#35774;&#22791;&#19981;&#25903;&#25345;&#25671;&#19968;&#25671;&#65281;',
            //     yesText : '&#30830;&#23450;',
            //     timeout :2.5,
            // });
        }
    }


    var shake_num = 1;

    function deviceMotionHandler(eventData){
        var acceleration=eventData.accelerationIncludingGravity;
        var curTime=new Date().getTime();
        var diffTime=curTime-last_update;

        if(diffTime>100){
            last_update=curTime;//记录上一次摇动的时间
            x=acceleration.x;//获取加速度X方向
            y=acceleration.y;//获取加速度Y方向
            z=acceleration.z;//获取加速度垂直方向
            var speed=Math.abs(x+y+z-last_x-last_y-last_z)/diffTime*10000;//计算阈值

            if(speed>SHAKE_THRESHOLD){
                if(shake_num > 1){
                    return false;
                }
                shake_num=2;
                //top.location.href = top.location.href+"#";
                document.getElementById('musicBox').play();
                setTimeout(dogetprize,1000);
            }
            //记录上一次加速度
            last_x=x;
            last_y=y;
            last_z=z;
        }
    }

    function ios13granted() {
        if (typeof DeviceMotionEvent.requestPermission === 'function') {
            DeviceMotionEvent.requestPermission().then(permissionState => {
                if (permissionState === 'granted') {
                    init(2) //摇一摇
                } else if(permissionState === 'denied'){
            // 打开的链接不是https开头
                    layer.msg("当前IOS系统拒绝访问动作与方向。请退出微信，重新进入活动页面获取权限。")
                }
            }).catch((error) => {
                alert("请求设备方向或动作访问需要用户手势来提示")
                console.log(error)
            })
        } else {
            // 处理常规的非iOS 13+设备
            console.log("处理常规的非iOS 13+设备")
            init(1)
        }
    }

    let GID = 0;
    var doingshakeprize = false;
    function dogetprize(){
        if(doingshakeprize){
            return false;
        }
        wid = {php echo empty($workerid)?0:$workerid;};
        $.ajax({
            type: 'POST',
            dataType : "json",
            url:'/{php echo createMobileUrl("yxgifts",array("themeid"=>$themeid,"op"=>"get"));}',
            data: {GLat:GLat,GLng:GLng,wid:wid},
            success: function(data) {
                if (data.error==1){
                    layer.msg(data.msg);
                }else{
                    $(".alertImg").attr("src",data.data.img);
                    $("#showGiftPyq").attr("data-gid",data.data.gid);
                    $(".alertTitle").text(data.msg);
                    $('#new_screen').show();
                    $('.getAlt').show();
                    if (data.data.flag_total && data.data.flag_total>0){
                        $(".yyyIcon").show();//图标显示
                    }
                }

            },
        }).error(function(){doingmarkshare = false});
    }

    //获取基础数据
    function getYxGiftBase() {
        $.ajax({
            type: 'POST',
            dataType : "json",
            url:'/{php echo createMobileUrl("yxgifts",array("themeid"=>$themeid,"op"=>"base"));}',
            data: {GLat:GLat,GLng:GLng,wid:wid},
            success: function(data) {
                if (data.error==1){
                    layer.msg(data.msg);
                }else{
                    if (data.data.flag_total && data.data.flag_total>0){
                        $(".yyyIcon").show();//图标显示
                    }
                }

            },
        }).error(function(){doingmarkshare = false});
    }
    //获取我的礼品
    function getMyGifts() {
        $.ajax({
            type: 'POST',
            dataType : "json",
            url:'/{php echo createMobileUrl("yxgifts",array("themeid"=>$themeid,"op"=>"my_gifts"));}',
            data: {GLat:GLat,GLng:GLng,wid:wid},
            success: function(data) {
                if (data.error==1){
                    layer.msg(data.msg);
                }else{
                    $("#list_ul").empty();
                    let list = data.data.list;
                    let rules = data.data.rules;
                    var temp_html = '';
                    for (var i = 0;i<list.length;i++){
                        temp_html += '<li>\n' +
                            '                        <div class="ticketInfor">\n' +
                            '                            <div class="ticketProduct">\n' +
                            '                                <img src="'+list[i].gimg+'">\n' +
                            '                            </div>\n' +
                            '                            <div class="getDate">\n' +
                            '                                <p>'+list[i].gname+'</p>\n' +
                            '                                <span>'+list[i].created_at+'</span>\n' +
                            '                            </div>\n' +
                            '                            <a href="javascript:void(0);" onclick="opGiftItem(this)"  data-status="'+list[i].status+'" data-convert="'+list[i].convert_url+'">'+list[i].btn_txt+'</a>\n' +
                            '                        </div>\n' +
                            '                    </li>';
                    }
                    $("#list_ul").append(temp_html);
                }

            },
        }).error(function(){doingmarkshare = false});
    }
    //按钮操作
    function opGiftItem(obj) {
        let status = $(obj).attr("data-status");
        let qr_code = $(obj).attr("data-convert");
        closeMyGifts();
        if (status==2){
            //填写客资
            $("#writeInfo").show();
            $('#new_screen').show();
        }else if (status==3){
            //待兑换 显示核销码 弹出客服
            show_qr('请截图保存兑换凭证发送给客服',qr_code);
        }
    }
    //关闭遮罩层以及表单提交信息
    function close_alert() {
        $("#new_screen").hide();
        $("#writeInfo").hide();
    }
    //客资信息提交
    function subCusterInfo(){
        $("#receive_btn").attr("disabled",true);
        layer.msg('加载中', {
            icon: 16
            ,shade: 0.05
        });
        var receive_name = $("#receive_name").val();
        var receive_phone = $("#receive_phone").val();
        if (receive_name.length<2){
            layer.msg('请填写您的真实姓名');
            return;
        }else if(receive_name.length>10){
            layer.msg('姓名长度限制10位');
            return;
        }else{
            //正则表达式
            var reg = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
            //判断输入框中有内容
            if(!reg.test(receive_name))
            {
                layer.msg("请输入中文、数字和英文！");
                return ;
            }
        }
        if (receive_phone.length!=11){
            layer.msg('电话请输入11位手机号码');
            return;
        }
        const regMobile = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
        if (!regMobile.test(receive_phone)) {
            layer.msg('手机号格式输入有误！')
            return;
        }
        var postUrl = '/{php echo createMobileUrl("yxgifts",array("themeid"=>$themeid,"op"=>"gift_user_info"));}';
        $.ajax({
            type:'POST',
            dataType:'json',
            data:{username:receive_name,mobile:receive_phone},
            url:postUrl,
            success:function (res){
                var data = res.data;
                $("#receive_btn").attr("disabled",false);
                layer.closeAll();
                if (res.error) {
                    layer.msg(res.msg);
                } else {
                    $("#new_screen").hide();
                    $("#writeInfo").hide();
                    layer.msg('提交成功');
                }

            }
        });
    }
    //关闭兑换核销码弹窗
    function closeQrShow(val) {

        $('.altBox1').fadeOut();
        $('#screen2').fadeOut();
        if (val==2){
            kfBtn();
        }
    }

    function show_qr(msg,qr_img){
        $('.altTit1').html(msg);
        $("#qr_img").attr("src",qr_img);
        $('.altBox1').fadeIn();
        $('#screen2').fadeIn();
    }


    function testDemo() {
        $('.altBox1').fadeIn();
        $('#screen2').fadeIn();
    }
    function showSharePyq(e) {
        let demo_gid = e.getAttribute("data-gid")
        GID = demo_gid;
        closeGetAlt();
        $("#mcover2").show();
    }
    function giftSharePyq(){
        if (GID){
            $.ajax({
                type: 'POST',
                dataType : "json",
                url:'/{php echo createMobileUrl("yxgifts",array("themeid"=>$themeid,"op"=>"pyq"));}',
                data: {gid:GID},
                success: function(data) {
                    layer.msg(data.msg);
                },
            }).error(function(){doingmarkshare = false});
        }
        GID = 0;
    }

    function hideScreen() {
        $('#new_screen').hide();
    }

    function closeGetAlt() {
        $('.getAlt').hide();
        hideScreen();
    }
    function closeMyGifts(){
        $('.myWinner').animate({'bottom':'-150%'},500)
        hideScreen();
    }
    $(".yyyIcon").click(function () {
        $('#new_screen').show();
        $('.myWinner').animate({'bottom':0},500)
        getMyGifts();
    });

    $(function () {

        $(".gift_div").on('click','.gift_span',function () {
            $('#new_screen').hide();
            $('.getAlt').hide();
        });
    });
</script>